/**
 * @fileOverview
 * @author iNahoo
 * @since 2019/12/18.
 */

class BaseBitMap {
    constructor(bitmap) {
        this.bitmap = bitmap;
    }

    transform(type) {
        this.bitmap = type.from(this.bitmap)
    }

    get Type() {
        return Object.getPrototypeOf(this.bitmap).constructor
    }

    traversal(fn) {
        const bm = this.bitmap;
        const len = bm.length;
        for (let i = 0; i < len; i++) {
            fn(bm[i], i);
        }
    }

}

module.exports = BaseBitMap;